﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
/// <summary>
/// SqlInsert 的摘要说明
/// </summary>
public class SqlInsert
{
	public SqlInsert()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//
	}
    public void InsertLoginInfo(string UserName,string LoginTime,string IP,string State)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
        con.Open();
        string sql = "insert into Logininfo values('"+UserName+"','"+LoginTime+"','"+IP+"','"+State+"')";
        SqlCommand com = new SqlCommand(sql,con);
        com.ExecuteNonQuery();
        com.Dispose();
        con.Close();
    }
    public void InsertClassInfo(string ClassID, string EntranceTime,int ManCount,string TeacherName,string Grade,string State)
    {
       
        SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
        con.Open();
        string sql = "insert into ClassInfo values('"+ClassID+"','"+EntranceTime+"','"+ManCount+"','"+TeacherName+"','"+Grade+"','"+State+"')";
        SqlCommand com = new SqlCommand(sql,con);
        com.ExecuteNonQuery();

        com.Dispose();
        con.Close();
    }
    public void InsertWorkLog(string UserName,string WorkTime,string WorkInfo)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
        con.Open();
        string sql = "insert into WorkLog values('"+UserName+"','"+WorkTime+"','"+WorkInfo+"')";
        SqlCommand com = new SqlCommand(sql,con);
        com.ExecuteNonQuery();
        con.Close();
    }
    public void InsertClassTeacher(string Classid,int TeacherID)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
        con.Open();
        string sql = "insert into ClassTeacher values('"+Classid+"',"+TeacherID+")";
        con.Close();
    }
    public int InsertStudentInfo(string Name,int Age,string Sex,string Address,string Phone,string ClassID,string addtime)
    {
        int Result;
        SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
        con.Open();
        string sql = "insert into StudentInfo values('"+Name+"',"+Age+",'"+Sex+"','"+Address+"','"+Phone+"','"+ClassID+"','"+addtime+"')";
        SqlCommand com = new SqlCommand(sql,con);
        Result = com.ExecuteNonQuery();
        return Result;
   
        
        
    }
    public void InsertCalendar(int TeacherID,string Motif,string Contert,string AddTime)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
        con.Open();
        string sql = "insert into Calendar values("+TeacherID+",'"+Motif+"','"+Contert+"','"+AddTime+"')";
        SqlCommand com = new SqlCommand(sql,con);
        com.ExecuteReader();
        com.Clone();
        con.Close();
    }
    public void InsertNotepaper(string Message,string AddTime,string UserName)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
        con.Open();
        string sql = "insert into Notepaper values('"+Message+"','"+AddTime+"','"+UserName+"')";
        SqlCommand com = new SqlCommand(sql,con);
        com.ExecuteNonQuery();
        con.Close();
    }
    
}

